﻿<ResourceDictionary 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="clr-namespace:Renci.iRods.Studio.ViewModels"
    xmlns:vw="clr-namespace:Renci.iRods.Studio.Views"
                    >

    <DataTemplate DataType="{x:Type vm:ConnectionProfileManagerViewModel}">
        <vw:ConnectionProfileManagerView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:ConnectionProfileSelectionViewModel}">
        <vw:ConnectionProfileSelectionView />
    </DataTemplate>
    

    <DataTemplate DataType="{x:Type vm:StatusBarNotConnectedViewModel}">
        <vw:StatusBarNotConnectedView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:StatusBarConnectedViewModel}">
        <vw:StatusBarConnectedView />
    </DataTemplate>

    <Style TargetType="{x:Type TextBox}">
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Margin" Value="0,2,40,2" />
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="true">
                        <Border Background="Red" DockPanel.Dock="right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="10"
                                    ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                            <TextBlock Text="!" VerticalAlignment="center" HorizontalAlignment="center" FontWeight="Bold" Foreground="white" />
                        </Border>
                        <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
                            <Border BorderBrush="red" BorderThickness="1" />
                        </AdornedElementPlaceholder>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="ClosableTabItemTemplate">
        <DockPanel Width="120">
            <Button 
        Command="{Binding Path=CloseCommand}"
        Content="X"
        Cursor="Hand"
        DockPanel.Dock="Right"
        Focusable="False"
        FontFamily="Courier" 
        FontSize="9"
        FontWeight="Bold"  
        Margin="0,1,0,0"
        Padding="0"
        VerticalContentAlignment="Bottom"
        Width="16" Height="16" 
        />
            <ContentPresenter 
        Content="{Binding Path=DisplayName}" 
        VerticalAlignment="Center" 
        />
        </DockPanel>
    </DataTemplate>
    
    <Style x:Key="ContextMenuItemStyle">
        <Setter Property="MenuItem.Header" Value="{Binding Text}"/>
        <Setter Property="MenuItem.ItemsSource" Value="{Binding Children}"/>
        <Setter Property="MenuItem.Command" Value="{Binding Command}" />
    </Style>
    
    <ContextMenu x:Key="ItemContextMenu" 
                 ItemsSource="{Binding Tag.ContextCommands}" 
                 ItemContainerStyle="{StaticResource ContextMenuItemStyle}" />

    <DataTemplate x:Key="SubmitWindowTemplate">
        <Grid MinWidth="250" MinHeight="100">
            <TextBlock TextWrapping="Wrap" Grid.Row="0" Text="{Binding Message}"/>
        </Grid>
    </DataTemplate>

</ResourceDictionary>